import time
from public.action import *
from public.business import *
from public.testData import *
from public.tools import *

testCase = "DBshop017-商品管理商品属性添加属性分组"
# 1.点击“添加属性组”，编辑属性组名称“好好学习”，属性组排序“1”。
firefox=openBrowser(urlAdmin)
DBshopLoginAdmin(firefox)
DBshopEnterMenu3(firefox,"商品管理","商品属性","属性分组")
firefox.find_element_by_link_text("添加属性组").click()
firefox.find_element_by_id("attribute_group_name").send_keys(goodsGroup)
str1=firefox.find_element_by_id("attribute_group_sort")
str1.clear()
str1.send_keys("1")
# 2.点击“保存属性分组信息”
firefox.find_element_by_xpath("//button").click()
time.sleep(2)
#断言
try:
    firefox.find_element_by_xpath("//td[text()='%s']"%goodsGroup).is_displayed()
    writeLog("%s 测试通过" % testCase)
except:
    writeLog("%s 测试失败" % testCase)
    getPhoto(firefox)
firefox.quit()